<?php

class conexion{

	private $bd = "";
	private $host = "";
	private $user = "";
	private $password = "";

	public function conexion($bd,$host,$user,$password){
		$this->bd = $bd;
		$this->host = $host;
		$this->user = $user;
		$this->password = $password;
	}

	function conectar(){
			
		if (!$conexion=mysql_connect($this->getHost(), $this->getUser(), $this->getPass())){
			echo "Error conectando a la base de datos.";
			exit();
		}
		if (!mysql_select_db($this->getBD(),$conexion)){
			echo "Error seleccionando la base de datos.";
			exit();
		}
		return $conexion;
	}

	public function getBD(){
		return $this->bd;
	}

	public function getHost(){
		return $this->host;
	}

	public function getUser(){
		return $this->user;
	}

	public function getPass(){
		return $this->password;
	}
}

?>